import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/main.dart';
import 'package:honeypotflutter/modules/billing/page/billing_info/view.dart';
import 'package:honeypotflutter/public/public_get.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import 'package:honeypotflutter/publicBussine/bussine_font.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_card.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_item.dart';
import '../model/billing_list.dart';

class BillingItem extends StatelessWidget {
  final BillingListModel itemModel;

  const BillingItem({
    super.key,
    required this.itemModel,
  });

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MGCard(
      radius: 0,
      children: [
        (itemModel.showDate != null)
            ? MGItems(
                margin: EdgeInsets.only(top: 0, bottom: 10),
                padding: EdgeInsets.all(0),
                leadTitle: itemModel.showDate,
                leadStyle: TextStyle(
                  fontWeight: FontWeight.bold,
                  fontSize: MGFont.textFont1,
                  color: MGColors.text1Color,
                ),
              )
            : Container(),
        MGItems(
          margin: EdgeInsets.all(0),
          padding: EdgeInsets.only(top: 5, bottom: 5),
          leadTitle: itemModel.expensesTypeDisplayName,
          trailingTitle: (itemModel.billTyp == 1) ? "+${itemModel.amount?.toStringAsFixed(2)}" : "-${itemModel.amount?.toStringAsFixed(2)}",
        )
      ],
      action: () {
        HLGet.to(BillingInfoPage(), arguments: itemModel);
      },
    );
  }
}
